// stack.cc
//
//		Stack! ah~ha!
//
// Copyright (c) 2011 HUST Seedclass yafeng.Tan

#include "copyright.h"

template<class T>
Stack<T>::Stack(unsigned int stacksize) {
	stackSize = stacksize;
	stack = new T[stackSize];
	Top = 0;
}

template<class T>
Stack<T>::~Stack() {
	delete stack;
}

template<class T>
bool Stack<T>::Push(T item) {
	ASSERT(!Full());
	stack[Top++] = item;
	return true;
}

template<class T>
T Stack<T>::Pop() {
	ASSERT(!Empty());
	return stack[--Top];
}

template<class T>
bool Stack<T>::Empty() {
	return (Top == 0);
}

template<class T>
bool Stack<T>::Full() {
	return (Top == stackSize);
}
